package spring_annotation.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import spring_annotation.pojo.Car;
import spring_annotation.pojo.Cat;

@Configuration
public class MainLifeCycleConfig {

    @Scope("prototype")     // 容器销毁 bean不会销毁
    @Bean(initMethod = "init", destroyMethod = "destroy")
    public Car car(){
        return new Car();
    }

    @Bean
    public Cat cat(){
        return new Cat();
    }
}
